<?php
namespace app\Index\controller;
use \think\Controller;
use think\Db;

class Index extends Controller
{
	/**
	* 五合一目录
	**/
	public function index(){
		//查询五合一目录
		$cates = Db('cates')->where('pid',0)->select();
		foreach($cates as $k => $v){
			$videos[$k]['cate'] = $v['name'];
			$videos[$k]['id'] =  $v['id'];
		}	
		$videos['0']['image'] = '/index/images/volume1.png';
		$videos['1']['image'] = '/index/images/volume2.png';
		$videos['2']['image'] = '/index/images/volume3.png';
		$videos['3']['image'] = '/index/images/volume4.png';
		$videos['4']['image'] = '/index/images/volume5.png';
		$videos['5']['image'] = '/index/images/volume6.png';
		$videos['6']['image'] = '/index/images/volume3.png';
		// var_dump($videos);die;
		$this->assign('videos',$videos);
        return $this->fetch();
    }

    /**
    ** 五合一视频
    **/
    public function video()
    {
    	$id = input('get.id');
    	$videos = Db('cates')->where('pid',$id)->select();
    	$this->assign('videos',$videos);
		return $this->fetch();
    }

    public function videoInfo()
    {
    	$id = input('get.id');
    	$videos = Db('video')->where('cate_id',$id)->select();
    	$this->assign('videos',$videos);
    	return $this->fetch();
    }

    public function videoIn()
    {
    	$id = input('get.id');
    	$video = Db('video')->where('id',$id)->find();
    	$videoUrl = $video['video_url'];
    	$this->assign('videoUrl',$videoUrl);
    	return $this->fetch();
    }
}
